package com.example.demo.mapper;

import com.example.demo.model.Book;
import com.example.demo.model.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BookMapper {

    @Select("select * from book")
    List<Book> selectAll();

    @Select("select * from book where id=${id}")
    Book selectById(int id);

    @Select("select * from book where name=${name}")
    List<Book> selectByName(String name);

    @Insert("insert into book(name,price) values(#{name},#{price})")
    int add(Book book);

    @Update("update book set #{name},#{price} where id=${id}")
    int updateById(Book book);
    @Delete("delete from book where id=${id}")
    int delById(int id);
}
